<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>我的预约</title>
<script type="text/javascript">
	var msg = '${cancelreservation}'
	if(msg=='未预约，无法取消！'){
		alert(msg)
	}else if(msg=='已取消预约！'){
		alert(msg)
	}
	
	var myreservation='${myreservation}'
	if(myreservation==''){
	alert("您没有预约")
	var user='${user}'
		if(user==''){
		window.location='menu_admin.jsp'
			}else{
				window.location='menu_stu.jsp'
			}
	
		}
</script>
<style>
		button{background-color:ivory;color:#705108}
		span{font-size: 20px; font-weight: bold;color:black}
        p{font-size: 20px; font-weight: bold;color:#836C0D}
		body {margin: 0;font-family: 'Lato', sans-serif; font-weight: 400;font-size: 15px;line-height: 25px;color: #333333;overflow-x: hidden;padding: 0;background-image:url(./imgs/bg.jpg);background-size:cover}
		.box{}
		.menu a:hover {background:#93A29D;color:white}
		.menu{border-bottom: 1px solid white;height: 85px;margin-top: 2px;width:100%}
		.b{margin-right: 10px; float:right;color:black;margin-bottom: auto;margin-top: 10px;color:white;font-family:幼圆;}
	    .b1{float:right;font-weight: 900;font-size: 150%;}
	    .c1{margin-left: 10px;float:left;height: 80px;margin-top: 15px}
		.d{margin-top: 60px; float:center;height: 250px}
		a{color:#4876F1}
		img{border-radius: 10px}
</style>

</head>
<body>
 	 <form action="cancelreservation" method="post">
	   <input type="hidden" name="method" value="${requestScope.method }">
       <input type="hidden" name="id" value="${requestScope.user.id }">
	   <div class="box">
		  <div class="menu">
			 <div class="b">
			    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			    &nbsp;欢迎您：${sessionScope.loginUser.username }
			    <a href="LogoutServlet" style="text-decoration: none">注销</a><br><br>
				 <div class="b1">
			     <c:choose>
				 <c:when test="${admin.name!=null }">
				 <a href="menu_admin.jsp" style="text-decoration: none;color: slategray">首页</a>
			     
	         	 </c:when>
				<c:otherwise>
				 <a href="menu_stu.jsp" style="text-decoration: none;color: slategray">首页</a>
				</c:otherwise>
				</c:choose>
	         		 <a href="roomreservation.jsp" style="text-decoration: none;color: slategray">预约</a>
		    		 
			    </div>
		     </div>
			 <div class="c1">
				 <img src="./imgs/nchu.png" alt="" height="50px" >
		     </div>
		   </div>
		   <center>
			<h3>我的预约</h3>
			<table border="2" align="center">
		<tr>
			<td style="text-align: center;">机房编号</td>
			<td style="text-align: center;">机房名称</td>
			<td style="text-align: center;">可容纳人数</td>
			<td style="text-align: center;">操作</td>
		</tr>
		 <tr>
		        <td><input type="text"  value="${myreservation.computerroomid}" disabled style="width: 90px;height: 20px;text-align: center;"></td>
				<td><input type="text"  value="${myreservation.classname}" disabled style="width: 90px;height: 20px;text-align: center;"></td>
				<td><input type="text"  value="${myreservation.capacity}" disabled style="width: 90px;height: 20px;text-align: center; "></td>
				<td>
				<c:choose>
				 <c:when test="${admin.name!=null }">
			     <a href="cancelreservation?id=${myreservation.id}&booker=${admin.name }">取消预约</a>
	         	 </c:when>
				<c:otherwise>
				<a href="cancelreservation?id=${myreservation.id}&booker=${user.username }">取消预约</a>
				</c:otherwise>
				</c:choose>
				</td>
		   </tr>
		   </table>
		   </center>
        </div>
        
     </form>
</body>
</html>
